//Project: Tenpenny Stories version 0.2 beta
//Coding by: Joshua Black aka JABHackSoul
//Questions email to jabhacksoul@yahoo.com
//Audio Splicing: Vincent Black aka ToonSkull/Evol Child 
//Additional Voices: Vincent Black and Brian Black aka Our Dad as Pendelbury
//Scripting Assistance: ZAZ & ceedj on GTAforums.com
//Ideas used: (coming soon!)  Submit Ideas to http://www.thegtaplace.com care of ToonSkull
//Gunia Pig Beta Testers here: (coming soon!) Bugs http://www.thegtaplace.com care of Jabhacksoul
//This script was produced for educational purposes.
//IF you redistribute DON'T REMOVE these comments they help others learn.
//You can add as much as you like but comment on the changes and improvements you made.
// Don't remove old buggy code just comment it out and explain why it was removed.
DEFINE MISSIONS 1              // Total Missions Available
DEFINE MISSION 0 AT @MISSN_06

DEFINE EXTERNAL_SCRIPTS 0 

DEFINE UNKNOWN_EMPTY_SEGMENT 0

DEFINE UNKNOWN_THREADS_MEMORY 500

{$VERSION 3.1.0027}
var
 $PLAYER_CHAR: Player
end // var 
//Main thread starts here
03A4: name_thread 'MAIN' 
//Set the screen BLACK immediately
016A: fade 0 time 0           
01F0: set_max_wanted_level_to 6 
0111: toggle_wasted_busted_check 0 
00C0: set_current_time_hours_to 8 minutes_to 0 
//Loads Tenpenny as #SPECIAL01 or 290
023C: load_special_actor 'TENPEN' as 1 
//Create Player at Station
04E4: unknown_refresh_game_renderer_at 1541 -1675.4 
Camera.SetAtPos(1541.156, -1675.352, 13.55)
$PLAYER_CHAR = Player.Create(#NULL, 1541.156, -1675.352, 13.552)
Player.SetClothes($PLAYER_CHAR, "VEST", "VEST", Torso)
Player.SetClothes($PLAYER_CHAR, "JEANSDENIM", "JEANS", Legs)
Player.SetClothes($PLAYER_CHAR, "SNEAKERBINCBLK", "SNEAKER", Shoes)
Player.SetClothes($PLAYER_CHAR, "PLAYER_FACE", "HEAD", Head)  
Player.Build($PLAYER_CHAR)
//Changes the player to ped model 290 Tenpenny
09C7: change_player $PLAYER_CHAR model_to 290 
01F5: $PLAYER_ACTOR = create_player_actor $PLAYER_CHAR 
07AF: $PLAYER_GROUP = player $PLAYER_CHAR group 
Model.Load(#COPBIKE)
Model.Load(#COPCARLA)
Model.Load(#DESERT_EAGLE)
Model.Load(#COLT45)
038B: load_requested_models 

:MAIN_110
if or
not Model.Available(#COPBIKE)
not Model.Available(#COPCARLA)
not Model.Available(#DESERT_EAGLE)
not Model.Available(#COLT45)
else_jump @MAIN_120 
wait 0 
jump @MAIN_110 
:MAIN_120
0674: set_car_model #COPCARLA numberplate "_CRASH_"
$My_Car = Car.Create(#COPCARLA,  1535.743, -1678.094, 13.09914)
$My_Bike = Car.Create(#COPBIKE, 1535.743, -1665.094, 13.09914)
Car.SetImmunities($My_Car, 0, 1, 0, 0, 0) 
Car.Angle($My_Car) = 0                       //Headed North
Car.DoorStatus($My_Car, 0)                   //No locked doors
053F: set_car $My_Car tires_vulnerability 0  //No popped tries


01B6: set_weather 1 
0001: wait 0 ms 
01B4: toggle_player $PLAYER_CHAR can_move false //We shut down control for the cameras to work 
04BB: select_interior 0 
0629: change_integer_stat 181 to 4 
016C: restart_if_wasted_at 2027.77 -1420.52 15.99 angle 137.0 town_number 0 
016D: restart_if_busted_at 1550.68 -1675.49 14.51 angle 90.0 town_number 0 
// Note: your missions have to use the variable defined here
0180: set_on_mission_flag_to $ONMISSION  
0004: $DEFAULT_WAIT_TIME = 250
03E6: remove_text_box 
$MISSION_1 = 2
// START GAME
$ONMISSION = 0 
01B4: toggle_player $PLAYER_CHAR can_move true               
fade 1 1000 
:MAIN_LOOP
0001: wait $DEFAULT_WAIT_TIME ms
00BF: $TIME_HOURS = current_time_hours, $TIME_MINS = current_time_minutes
if and
$ONMISSION == 0
00E1:   player 0 pressed_key 11
jf @MAIN_LOOP
start_mission 0 
0002: jump @MAIN_LOOP 

//-------------Mission 23---------------
// Originally: Gray Imports
{ This mission was edited from the original mission above "Gray Exports" reveals
why Tenpenny gave you the tip to the Russians and Ballas doing business together. This is
another prequel like mission, but unlike CJ, Officer Tenpenny can crack keypads and
not shoot them off walls. Only the initial setup is copied from the Gray Imports. After the 
point I indicate below is my original coding. The idea is this mission is designed to be like
Splinter Cell where you go in all stealth.}

:MISSN_06
thread 'MISSN_06' 
$ONMISSION = 1 
054C: use_GXT_table 'JABM06' 
gosub @MISSN_06_BEGIN

00D6: if
0112:   wasted_or_busted
004D: jump_if_false @MISSN_06_END
0050: gosub @MISSN_06_800

:MISSN_06_END
0050: gosub @MISSN_06_CLEANUP
004E: end_thread

:MISSN_06_CLEANUP
$ONMISSION = 0 
03C7: set_sensitivity_to_crime 1.0   
mission_cleanup
return

:MISSN_06_BEGIN
00BC: show_text_highpriority GXT 'GEX00' time 8000 flag 1  
wait 8000
03DE: set_pedestrians_density_multiplier_to 0.0 
01EB: set_traffic_density_multiplier_to 0.0 
0395: clear_area 0 at 1036.86 -1336.49 20.0 radius 20.0 

Model.Load(#FORKLIFT)
Model.Load(#MULE)
Model.Load(#MP5LNG)
Model.Load(#SEC_KEYPAD)
Model.Load(#KMB_RAMP)
Model.Load(#URANUS)      
Model.Load(#BF400) 
Model.Load(#KNIFECUR)
Model.Load(#SILENCED)
07C0: load_path 310 
07C0: load_path 328 
07C0: load_path 329 
07C0: load_path 309
038B: load_requested_models 

:MISSN_06_100
wait 0
if and
   Model.Available(#FORKLIFT)
   Model.Available(#MULE)
   Model.Available(#SEC_KEYPAD)
   Model.Available(#MP5LNG)
   Model.Available(#KMB_RAMP)
   Model.Available(#URANUS)
   Model.Available(#BF400)
   Model.Available(#KNIFECUR)
else_jump @MISSN_06_100 

Model.Load(#IMCMPTRKDRL_LAS)
Model.Load(#IMCMPTRKDRR_LAS)
Model.Load(#IMCOMPMOVEDR1_LAS)
Model.Load(#WMYMECH)
Model.Load(#COLT45)
Model.Load(#BARREL4)
Model.Load(#IRGOGGLES)
038B: load_requested_models 

:MISSN_06_110
wait 0
if and
   Model.Available(#WMYMECH)
   Model.Available(#COLT45)
   Model.Available(#BARREL4)
   Model.Available(#IMCMPTRKDRL_LAS)
   Model.Available(#IMCMPTRKDRR_LAS)
   Model.Available(#IMCOMPMOVEDR1_LAS)
   Model.Available(#SILENCED)
   Model.Available(#IRGOGGLES)
else_jump  @MISSN_06_110 
//Dress CJ for cut scene
09C7: change_player $PLAYER_CHAR model_to #NULL 
Player.SetClothes($PLAYER_CHAR, "hoodyAgreen", "hoodyA", Torso)
Player.SetClothes($PLAYER_CHAR, "chinosbiege", "chinosb", Legs)
Player.SetClothes($PLAYER_CHAR, "convheatred", "conv", Shoes)
Player.SetClothes($PLAYER_CHAR, "goatee", "HEAD", Head)  
Player.Build($PLAYER_CHAR)
//Changes the player to ped model 290 Tenpenny
09C7: change_player $PLAYER_CHAR model_to 290 

0395: clear_area 1 at 2174.896 -2258.914 150.0 radius 150.0 
03C7: set_sensitivity_to_crime 0.0 
03DE: set_pedestrians_density_multiplier_to 1.0 
01EB: set_traffic_density_multiplier_to 1.0 

141@ = 15.9  //Main Door Position up and down
142@ = 0     //Generic Event Checking
143@ = 0     //Guard 1 Check points
144@ = 0     //Guard 2 Check points
145@ = 0     //Guard 3 Check points
146@ = 0     //Guard Index 62 - 68
147@ = 0     //Guard 4 Check points
148@ = 0     //Guard 5 Check points
 

060A: create_decision_maker_type 0 store_to 52@
Camera.SetAtPos(2212.02, -2225.45, 12.24)
34@ = Object.Create(#IMCMPTRKDRL_LAS, 2192.925, -2231.824, 14.205)
35@ = Object.Create(#IMCMPTRKDRR_LAS, 2195.072, -2229.589, 14.205)
Object.Angle(34@) = 135.0
Object.Angle(35@) = 85.0
36@ = Object.Create(#IMCMPTRKDRL_LAS, 2200.184, -2224.419, 14.205)
37@ = Object.Create(#IMCMPTRKDRR_LAS, 2202.432, -2222.266, 14.205)
Object.Angle(36@) = 135.0
Object.Angle(37@) = 85.0
38@ = Object.Create(#IMCMPTRKDRL_LAS, 2207.766, -2217.281, 14.205)
39@ = Object.Create(#IMCMPTRKDRR_LAS, 2210.014, -2215.058, 14.205)
Object.Angle(38@) = 135.0
Object.Angle(39@) = 85.0
40@ = Object.Create(#IMCMPTRKDRL_LAS, 2215.096, -2210.761, 14.205)
41@ = Object.Create(#IMCMPTRKDRR_LAS, 2217.344, -2208.537, 14.205)
Object.Angle(40@) = 135.0
Object.Angle(41@) = 85.0
42@ = Object.Init(#KMB_RAMP, 2193.418, -2231.352, 14.183)
43@ = Object.Init(#KMB_RAMP, 2194.642, -2230.128, 14.183)
44@ = Object.Init(#KMB_RAMP, 2200.686, -2224.019, 14.183)
45@ = Object.Init(#KMB_RAMP, 2201.91, -2222.795, 14.183)
46@ = Object.Init(#KMB_RAMP, 2208.243, -2216.833, 14.183)
47@ = Object.Init(#KMB_RAMP, 2209.468, -2215.609, 14.183)
48@ = Object.Init(#KMB_RAMP, 2215.489, -2210.406, 14.183)
49@ = Object.Init(#KMB_RAMP, 2216.713, -2209.182, 14.183)
0453: set_object 42@ XY_rotation 0.0 0.0 angle 45.0 
0453: set_object 43@ XY_rotation 0.0 0.0 angle 45.0 
0453: set_object 44@ XY_rotation 0.0 0.0 angle 45.0 
0453: set_object 45@ XY_rotation 0.0 0.0 angle 45.0 
0453: set_object 46@ XY_rotation 0.0 0.0 angle 45.0 
0453: set_object 47@ XY_rotation 0.0 0.0 angle 45.0 
0453: set_object 48@ XY_rotation 0.0 0.0 angle 45.0 
0453: set_object 49@ XY_rotation 0.0 0.0 angle 45.0 
50@ = Object.Init(#IMCOMPMOVEDR1_LAS, 2178.073, -2254.384, 15.9)
Object.Angle(50@) = 224.0
51@ = Object.Create(#SEC_KEYPAD, 2174.896, -2258.914, 15.0)
Object.KeepInMemory(51@) = True
Object.Angle(51@) = 35.23
071F: set_object 51@ health_to 10 
0875: unknown_object 51@ flag 1 
73@ = Object.Create(#BARREL4, 2187.538, -2255.581, 12.51)
0875: unknown_object 73@ flag 1 
58@ = Car.Create(#MULE, 2175.94, -2268.1, 12.66)
Car.Angle(58@) = 48.24
Car.Health(58@) = 450
59@ = Car.Create(#MULE, 2159.395, -2295.29, 12.688)
Car.Angle(59@) = 44.51
Car.Health(59@) = 450
60@ = Car.Create(#FORKLIFT, 2174.87, -2289.22, 12.06)
Car.Angle(60@) = 321.59
0129: 62@ = create_actor_pedtype 24 model #WMYMECH in_car 60@ driverseat 
61@ = Car.Create(#FORKLIFT, 2193.25, -2256.4, 12.25)
Car.Angle(61@) = 266.92
0129: 63@ = create_actor_pedtype 24 model #WMYMECH in_car 61@ driverseat 
04E0: car 61@ abandon_path_radius 150 
060B: set_actor 63@ decision_maker_to 52@ 

71@ = Object.Create(#BARREL4, 2179.18, -2270.92, -14.0)
0875: unknown_object 71@ flag 1 
72@ = Object.Create(#BARREL4, 2179.18, -2270.92, -10.0)
0875: unknown_object 72@ flag 1 
0681: attach_object 71@ to_car 60@ with_offset 0.5 0.3 0.3 rotation 0.0 0.0 0.0 
0681: attach_object 72@ to_car 60@ with_offset -0.5 0.3 0.3 rotation 0.0 0.0 0.0 
05D1: AS_actor 62@ drive_car 60@ to 2179.49 -2280.46 14.03 speed 5.0 0 model #NULL 3 

69@ = Object.Create(#BARREL4, 2179.18, -2270.92, -14.0)
0875: unknown_object 69@ flag 1 
70@ = Object.Create(#BARREL4, 2179.18, -2270.92, -10.0)
0875: unknown_object 70@ flag 1 
0681: attach_object 69@ to_car 61@ with_offset 0.5 0.3 0.3 rotation 0.0 0.0 0.0 
0681: attach_object 70@ to_car 61@ with_offset -0.5 0.3 0.3 rotation 0.0 0.0 0.0 
05D1: AS_actor 63@ drive_car 61@ to 2209.1 -2253.64 12.25 speed 6.0 0 model #NULL 3 

54@ = Car.Create(#URANUS, 2207.7, -2246.157, 12.597)
06ED: set_car 54@ paintjob 2 
56@ = Car.Create(#URANUS, 2218.87, -2234.29, 12.6)
06ED: set_car 56@ paintjob 1

0129: 83@ = create_actor_pedtype 24 model #WMYMECH in_car 54@ driverseat 
060B: set_actor 83@ decision_maker_to 52@ 
55@ = Car.Create(#BF400, 2212.9, -2241.6, 12.59)
0129: 84@ = create_actor_pedtype 24 model #WMYMECH in_car 55@ driverseat 
060B: set_actor 84@ decision_maker_to 52@ 
0129: 85@ = create_actor_pedtype 24 model #WMYMECH in_car 56@ driverseat 
060B: set_actor 85@ decision_maker_to 52@ 
57@ = Car.Create(#BF400, 2224.3, -2228.19, 12.597)
0129: 86@ = create_actor_pedtype 24 model #WMYMECH in_car 57@ driverseat 
060B: set_actor 86@ decision_maker_to 52@ 
64@ = Actor.Create(Mission1, #WMYMECH, 2181.97, -2252.695, 13.82)
Actor.Angle(64@) = 231.26
01B2: give_actor 64@ weapon 29 ammo 99999 // Load the weapon model before using this 
Actor.WeaponAccuracy(64@) = 30
65@ = Actor.Create(Mission1, #WMYMECH, 2189.65, -2250.05, 12.597)
Actor.Angle(65@) = 229.24
060B: set_actor 65@ decision_maker_to 52@ 
01B2: give_actor 65@ weapon 22 ammo 9999 // Load the weapon model before using this 
Actor.WeaponAccuracy(65@) = 30
66@ = Actor.Create(Mission1, #WMYMECH, 2193.126, -2233.95, 12.59)
Actor.Angle(66@) = 249.77
060B: set_actor 66@ decision_maker_to 52@ 
01B2: give_actor 66@ weapon 29 ammo 9999 // Load the weapon model before using this 
Actor.WeaponAccuracy(66@) = 30
67@ = Actor.Create(Mission1, #WMYMECH, 2199.71, -2257.841, 12.597)
Actor.Angle(67@) = 347.22
060B: set_actor 67@ decision_maker_to 52@ 
01B2: give_actor 67@ weapon 22 ammo 9999 // Load the weapon model before using this 
Actor.WeaponAccuracy(67@) = 30
68@ = Actor.Create(Mission1, #WMYMECH, 2200.2, -2256.49, 12.597)
Actor.Angle(68@) = 168.1
0677: AS_actor 67@ chat_with_actor 68@ lead_speaker_flag 1 unknown_flag 1 
060B: set_actor 68@ decision_maker_to 52@ 
01B2: give_actor 68@ weapon 29 ammo 9999 // Load the weapon model before using this 
Actor.WeaponAccuracy(68@) = 30
0677: AS_actor 68@ chat_with_actor 67@ lead_speaker_flag 0 unknown_flag 1 
018A: 167@ = create_checkpoint_at 2247.639 -2202.144 12.59
//Finished with setup the rest is original
:MISSN_06_120
wait 0
if 
00FE:   actor $PLAYER_ACTOR sphere 1 in_sphere 2247.639 -2202.144 12.59 radius 5.0 5.0 5.0 
else_jump  @MISSN_06_120 

//Give Tenpenny the Googles, Knife and Silencer
01B2: give_actor $PLAYER_ACTOR weapon 45 ammo 9999  
01B2: give_actor $PLAYER_ACTOR weapon 4 ammo 9999  
01B2: give_actor $PLAYER_ACTOR weapon 23 ammo 17 
0164: disable_marker 167@
00C0: set_current_time_hours_to 22 minutes_to 0 
//Cut Scene
02A3: enable_widescreen 1 
05EB: assign_car 55@ to_path 310 
05EB: assign_car 56@ to_path 328 
05EB: assign_car 57@ to_path 329 
05EB: assign_car 54@ to_path 309 
015F: set_camera_position 2236.0857 -2225.2952 15.0 rotation 0.0 0.0 0.0 
Camera.PointAt(2204.3667, -2218.5129, 13.5469, 2)
00BC: show_text_highpriority GXT 'GEX01' time 8000 flag 1  
wait 8000
                      
Camera.SetPosition(2200.1631, -2254.7815, 13.5469, 0.0, 0.0, 0.0)
Camera.PointAt(2200.043, -2256.8494, 14.0, 2)
00BC: show_text_highpriority GXT 'GEX02' time 8000 flag 1  
wait 6000

Camera.SetPosition(2177.2615, -2258.8103, 15.0, 0.0, 0.0, 0.0)
Camera.PointAt(2175.2529, -2259.1265, 14.7734, 2)
00BC: show_text_highpriority GXT 'GEX03' time 8000 flag 1  
wait 3000

05D1: AS_actor 62@ drive_car 60@ to 2187.88 -2265.11 12.6 speed 6.0 0 model #NULL 3 

Camera.SetPosition(2207.014, -2244.207, 13.7376, 0.0, 0.0, 0.0)
Camera.PointAt(2206.333, -2243.486, 13.613, 2)

wait 3000
//Drivers of the Cars loaded into trucks
Actor.DestroyInstantly(83@)
Actor.DestroyInstantly(84@)
Actor.DestroyInstantly(85@)
Actor.DestroyInstantly(86@)

133@ = Pickup.Create(#BODYARMOUR, 3, 2186.507, -2244.993, 15.81)
134@ = Pickup.Create(#BODYARMOUR, 3, 2146.559, -2244.46, 13.58)
135@ = Pickup.Create(#HEALTH, 3, 2158.82, -2232.747, 13.59)
wait 2000
02A3: enable_widescreen 0
//End Cut Scene 
Camera.Restore_WithJumpCut
Camera.SetBehindPlayer

162@ = 2180.5
163@ = -2278.5 
05D1: AS_actor 62@ drive_car 60@ to 162@ 163@ 13.7 speed 5.0 0 model #NULL 3 
164@ = 2212.0
165@ = -2234.0
05D1: AS_actor 63@ drive_car 61@ to 164@ 165@ 13.7 speed 5.0 0 model #NULL 3 
//03C4: set_status_text $7613 type 1 GXT 'DES6_50' //Was going to be a stealth meter. Felt like too much.

:MISSN_06_200
wait 0

//Random Forktruck driver #1
if and
not Actor.Dead(63@)
00FE:   actor 63@ sphere 0 in_sphere 164@ 165@ 13.7 radius 4.0 4.0 2.0 
jf @MISSN_06_210

0208: 164@ = random_float_in_ranges -0.2 0.2 
if
164@ > 0.0 
then
164@ = 2212.0
0208: 165@ = random_float_in_ranges -2252.5 -2215.0 
else  
0208: 164@ = random_float_in_ranges 2196.0 2229.0
165@ = -2234.0
end
05D1: AS_actor 63@ drive_car 61@ to 164@ 165@ 13.7 speed 5.0 0 model #NULL 3 

:MISSN_06_210
//Random Forktruck driver #2
if and
not Actor.Dead(62@)
00FE:   actor 62@ sphere 0 in_sphere 162@ 163@ 13.7 radius 4.0 4.0 2.0 
jf @MISSN_06_220

0208: 162@ = random_float_in_ranges -0.2 0.2 
if
162@ > 0.0 
then
162@ = 2180.5
0208: 163@ = random_float_in_ranges -2279.0 -2327.0
else  
0208: 162@ = random_float_in_ranges 2159.9 2194.3
163@ = -2278.5
end
05D1: AS_actor 62@ drive_car 60@ to 162@ 163@ 13.7 speed 5.0 0 model #NULL 3 

:MISSN_06_220
//Guard 1 walks a loop path
if and
not Actor.Dead(64@) 
02A0:   actor 64@ stopped 
jf @MISSN_06_240
//Skipped when the Actor is alive and moving.
143@ += 1
if 
143@ >= 12 
then
143@ = 0
end
if
143@ == 0
then
05D3: AS_actor 64@ goto_point 2181.7083 -2252.8679 14.7734 mode 4 -2 ms 
end
if
143@ == 1
then
05D3: AS_actor 64@ goto_point 2176.0869 -2259.4487 14.7734 mode 4 -2 ms 
end
if
143@ == 2
then
05D3: AS_actor 64@ goto_point 2187.3491 -2259.6792 13.4511 mode 4 -2 ms 
end
if
143@ == 3
then
05D3: AS_actor 64@ goto_point 2201.426 -2245.2866 13.5469 mode 4 -2 ms 
end
if
143@ == 4
then
05D3: AS_actor 64@ goto_point 2178.0857 -2223.8364 13.4844 mode 4 -2 ms 
end
if
143@ == 5
then
05D3: AS_actor 64@ goto_point 2157.8755 -2226.3157 13.394 mode 4 -2 ms 
end
if
143@ == 6
then
05D3: AS_actor 64@ goto_point 2113.6719 -2271.8633 13.5383 mode 4 -2 ms 
end
if
143@ == 7
then
05D3: AS_actor 64@ goto_point 2129.0088 -2291.7991 13.4491 mode 4 -2 ms 
end
if
143@ == 8
then
05D3: AS_actor 64@ goto_point 2115.5613 -2274.6956 20.676 mode 4 -2 ms 
end
if
143@ == 9
then
05D3: AS_actor 64@ goto_point 2130.5649 -2305.3682 13.4834 mode 4 -2 ms 
end
if
143@ == 10
then
05D3: AS_actor 64@ goto_point 2148.7549 -2320.7429 13.5312 mode 4 -2 ms 
end
if
143@ == 11
then
05D3: AS_actor 64@ goto_point 2194.21 -2270.9294 13.5547 mode 4 -2 ms 
end

:MISSN_06_240
//Guard 2 walks a loop path
if and
not Actor.Dead(65@)
02A0:   actor 65@ stopped 
jf @MISSN_06_260

144@ += 1
if 
144@ >= 4 
then
144@ = 0
end
if
144@ == 0
then
05D3: AS_actor 65@ goto_point 2200.8591 -2262.4573 13.5547 mode 4 -2 ms 
end
if
144@ == 1
then
05D3: AS_actor 65@ goto_point 2236.1316 -2225.7161 13.5547 mode 4 -2 ms 
end
if
144@ == 2
then
05D3: AS_actor 65@ goto_point 2222.6514 -2212.5574 13.5469 mode 4 -2 ms 
end
if
144@ == 3
then
05D3: AS_actor 65@ goto_point 2198.8647 -2234.8967 13.5469 mode 4 -2 ms 
end

:MISSN_06_260
//Guard 3 walks a loop path 
if and
not Actor.Dead(66@)
02A0:   actor 66@ stopped 
jf @MISSN_06_270
145@ += 1
if 
145@ >= 2
then
145@ = 0
end
if
145@ == 0
then
05D3: AS_actor 66@ goto_point 2212.3574 -2252.5759 13.5547 mode 4 -2 ms 
end
if  
145@ == 1
then
05D3: AS_actor 66@ goto_point 2170.5002 -2289.6121 13.5411 mode 4 -2 ms 
end          
:MISSN_06_270
//Guard spots Frank ALARM is Raised
146@ += 1
if 
146@ >= 7
then
    146@ = 0
end
//If the guard is not dead, this code projects a sphere 7 meters infront of the guard
//with a diameter of 9 meters. I know the code says radius but if that was correct the
//sphere would go behind the guard and you would never be able to sneak up on him from behind.*
if 
    not Actor.Dead(62@(146@,7i))
then
    04C4: store_coords_to 151@ 152@ 153@ from_actor 62@(146@,7i) with_offset 0.0 7.5 0.0 
    if 
      031D:   actor 62@(146@,7i) hit_by_weapon 23
    then
      05E2: AS_actor 62@(146@,7i) kill_actor $PLAYER_ACTOR   
    end
    if and
    143@ >= 0                                                                 
    00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 151@ 152@ 153@ radius 9.0 9.0 9.0 
    then
        jump @MISSN_06_500
    end
end

//Frank makes it to the keypad and cracks the code
//I know the ATM animation could be improved... too lazy I guess.
if and
142@ == 0
00FE:   actor $PLAYER_ACTOR sphere 1 in_sphere 2175.2529 -2259.1265 14.7734 radius 1.0 1.0 1.0 
then
    Actor.Angle($PLAYER_ACTOR) = 51.0
    0605: actor $PLAYER_ACTOR perform_animation_sequence "ATM" IFP_file "PED" 4.0 loop 0 0 0 0 time 2000 
    0613: 26@ = actor $PLAYER_ACTOR animation "ATM" time 
    142@ = 1
    wait 2000     
    097B: play_audio_at_object 50@ event 1035 //Door Sound
end 
//Gate goes up
if and
141@ < 19.5
142@ == 1
then
141@ += 0.1
if 
141@ >= 19.5 
then 
    097B: play_audio_at_object 50@ event 1036  //Kill Sound
end
01BC: put_object 50@ at 2178.073 -2254.384 141@ //Raises the gate 
end    
//Inside checkpoint
if and
142@ == 1
00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 2174.0808 -2251.2556 13.3032 radius 8.0 8.0 1.0 
then
    142@ = 2
    097B: play_audio_at_object 50@ event 1035 //Door Sound
end
//Gate goes down
if and
141@ > 15.9
142@ == 2
then
141@ -= 0.1
if 
141@ <= 15.9 
then 
    097B: play_audio_at_object 50@ event 1036  //Kill Sound
    142@ = 3
04F9: set_interior 0 color_to 0 
end
01BC: put_object 50@ at 2178.073 -2254.384 141@ //Lowers the gate
end 
//No barrels or the keypad can get destroyed or mission failed
if and
8366:   not object 51@ damaged 
8366:   not object 69@ damaged 
8366:   not object 70@ damaged
8366:   not object 71@ damaged
8366:   not object 72@ damaged
8366:   not object 73@ damaged
jf @MISSN_06_800

{ This point tells us that all the things outside are done so we can
toss them in the trash and move those men inside the warehouse.
To sum this up part A of the mission is complete and part B is now loaded.}
if
142@ == 3 
jf @MISSN_06_200

//Part B sneaking around inside like Sam Fisher.
:MISSN_06_300
//Set up interior Guards
142@ = 0
143@ = 4
144@ = 0
145@ = 0
147@ = 0
148@ = 0

64@ = Actor.Create(Mission1, #WMYMECH, 2166.0129, -2239.7473, 13.2866)
01B2: give_actor 64@ weapon 29 ammo 99999 // Load the weapon model before using this 
Actor.WeaponAccuracy(64@) = 30
060B: set_actor 64@ decision_maker_to 52@ 
65@ = Actor.Create(Mission1, #WMYMECH, 2153.7788, -2243.3887, 13.3007)
060B: set_actor 65@ decision_maker_to 52@ 
01B2: give_actor 65@ weapon 22 ammo 9999 // Load the weapon model before using this 
Actor.WeaponAccuracy(65@) = 30
060B: set_actor 65@ decision_maker_to 52@ 
66@ = Actor.Create(Mission1, #WMYMECH, 2156.6182, -2270.3901, 13.3038)
060B: set_actor 66@ decision_maker_to 52@ 
01B2: give_actor 66@ weapon 29 ammo 9999 // Load the weapon model before using this 
Actor.WeaponAccuracy(66@) = 30
060B: set_actor 66@ decision_maker_to 52@ 
67@ = Actor.Create(Mission1, #WMYMECH, 2139.3755, -2270.9983, 17.5625)
060B: set_actor 67@ decision_maker_to 52@ 
01B2: give_actor 67@ weapon 22 ammo 9999 // Load the weapon model before using this 
Actor.WeaponAccuracy(67@) = 30
060B: set_actor 67@ decision_maker_to 52@ 
68@ = Actor.Create(Mission1, #WMYMECH, 2178.282, -2251.1094, 20.6719)
0677: AS_actor 67@ chat_with_actor 68@ lead_speaker_flag 1 unknown_flag 1 
060B: set_actor 68@ decision_maker_to 52@ 
01B2: give_actor 68@ weapon 29 ammo 9999 // Load the weapon model before using this 
Actor.WeaponAccuracy(68@) = 30
060B: set_actor 68@ decision_maker_to 52@ 
//Make the guards start walking
05D3: AS_actor 64@ goto_point 2161.2422 -2246.8901 13.2917 mode 4 -2 ms
05D3: AS_actor 65@ goto_point 2153.7788 -2243.3887 13.3007 mode 4 -2 ms
05D3: AS_actor 66@ goto_point 2156.6182 -2270.3901 13.3038 mode 4 -2 ms
05D3: AS_actor 67@ goto_point 2139.3755 -2270.9983 17.5625 mode 4 -2 ms
05D3: AS_actor 68@ goto_point 2178.282 -2251.1094 20.6719 mode 4 -2 ms

:MISSN_06_310
wait 0

:MISSN_06_320
//Guard 1 walks a loop path
if and
not Actor.Dead(64@)
02A0:   actor 64@ stopped 
jf @MISSN_06_330

143@ += 1
if 
143@ >= 12 
then
143@ = 0
end
if
143@ == 0
then
05D3: AS_actor 64@ goto_point 2176.0168 -2252.5842 13.3044 mode 4 -2 ms 
end
if
143@ == 1
then
05D3: AS_actor 64@ goto_point 2168.1069 -2254.0479 13.3021 mode 4 -2 ms 
end
if
143@ == 2
then
05D3: AS_actor 64@ goto_point 2161.2422 -2246.8901 13.2917 mode 4 -2 ms 
end
if
143@ == 3
then
05D3: AS_actor 64@ goto_point 2166.0129 -2239.7473 13.2866 mode 4 -2 ms 
end
if
143@ == 4
then
05D3: AS_actor 64@ goto_point 2161.2422 -2246.8901 13.2917 mode 4 -2 ms 
end
if
143@ == 5
then
05D3: AS_actor 64@ goto_point 2168.1069 -2254.0479 13.3021 mode 4 -2 ms 
end

:MISSN_06_330
//Guard 2 walks a loop path
if and
not Actor.Dead(65@)
02A0:   actor 65@ stopped 
jf @MISSN_06_340
144@ += 1
if 
144@ >= 4 
then
144@ = 0
end
if
144@ == 0
then
05D3: AS_actor 65@ goto_point 2153.7788 -2243.3887 13.3007 mode 4 -2 ms 
end
if
144@ == 1
then
05D3: AS_actor 65@ goto_point 2151.533 -2247.3108 13.299 mode 4 -2 ms 
end
if
144@ == 2
then
05D3: AS_actor 65@ goto_point 2167.0049 -2261.644 13.3044 mode 4 -2 ms 
end
if
144@ == 3
then
05D3: AS_actor 65@ goto_point 2151.533 -2247.3108 13.299 mode 4 -2 ms 
end

:MISSN_06_340
//Guard 3 walks a loop path
if and
not Actor.Dead(66@)
02A0:   actor 66@ stopped 
jf @MISSN_06_350
145@ += 1
if 
145@ >= 14 
then
145@ = 0
end
if
145@ == 0
then
05D3: AS_actor 66@ goto_point 2156.6182 -2270.3901 13.3038 mode 4 -2 ms 
end
if
145@ == 1
then
05D3: AS_actor 66@ goto_point 2145.3733 -2261.4651 13.2984 mode 4 -2 ms 
end
if
145@ == 2
then
05D3: AS_actor 66@ goto_point 2134.1743 -2265.7319 14.7861 mode 4 -2 ms 
end
if
145@ == 3
then
05D3: AS_actor 66@ goto_point 2139.3755 -2270.9983 17.5625 mode 4 -2 ms 
end
if
145@ == 4
then
05D3: AS_actor 66@ goto_point 2134.1306 -2275.8506 20.6719 mode 4 -2 ms 
end
if
145@ == 5
then
05D3: AS_actor 66@ goto_point 2124.9932 -2266.8147 20.6673 mode 4 -2 ms 
end
if
145@ == 6
then
05D3: AS_actor 66@ goto_point 2144.27 -2248.9321 20.6641 mode 4 -2 ms 
end
if
145@ == 7
then
05D3: AS_actor 66@ goto_point 2159.9297 -2265.1814 20.6669 mode 4 -2 ms 
end
if
145@ == 8
then
05D3: AS_actor 66@ goto_point 2144.27 -2248.9321 20.6641 mode 4 -2 ms 
end
if
145@ == 9
then
05D3: AS_actor 66@ goto_point 2124.9932 -2266.8147 20.6673 mode 4 -2 ms 
end
if
145@ == 10
then
05D3: AS_actor 66@ goto_point 2134.1306 -2275.8506 20.6719 mode 4 -2 ms 
end
if
145@ == 11
then
05D3: AS_actor 66@ goto_point 2139.3755 -2270.9983 17.5625 mode 4 -2 ms 
end
if
145@ == 12
then
05D3: AS_actor 66@ goto_point 2134.1743 -2265.7319 14.7861 mode 4 -2 ms 
end
if
145@ == 13
then
05D3: AS_actor 66@ goto_point 2145.3733 -2261.4651 13.2984 mode 4 -2 ms 
end

:MISSN_06_350
//Guard 4 walks a loop path
if and
not Actor.Dead(67@)
02A0:   actor 67@ stopped 
jf @MISSN_06_360
147@ += 1
if 
147@ >= 14 
then
147@ = 0
end

if
147@ == 0
then
05D3: AS_actor 67@ goto_point 2156.6182 -2270.3901 13.3038 mode 4 -2 ms 
end                                                       
if                                                        
147@ == 1                                                 
then                                                      
05D3: AS_actor 67@ goto_point 2145.3733 -2261.4651 13.2984 mode 4 -2 ms 
end                                                       
if                                                        
147@ == 2                                                 
then                                                      
05D3: AS_actor 67@ goto_point 2134.1743 -2265.7319 14.7861 mode 4 -2 ms 
end                                                       
if                                                        
147@ == 3                                                 
then                                                      
05D3: AS_actor 67@ goto_point 2139.3755 -2270.9983 17.5625 mode 4 -2 ms 
end                                                       
if                                                        
147@ == 4                                                 
then                                                      
05D3: AS_actor 67@ goto_point 2134.1306 -2275.8506 20.6719 mode 4 -2 ms 
end                                                       
if                                                        
147@ == 5                                                 
then                                                      
05D3: AS_actor 67@ goto_point 2124.9932 -2266.8147 20.6673 mode 4 -2 ms 
end                                                       
if                                                        
147@ == 6                                                 
then                                                      
05D3: AS_actor 67@ goto_point 2144.27 -2248.9321 20.6641   mode 4 -2 ms 
end
if
147@ == 7
then
05D3: AS_actor 67@ goto_point 2159.9297 -2265.1814 20.6669 mode 4 -2 ms 
end                                                       
if                                                        
147@ == 8                                                 
then                                                      
05D3: AS_actor 67@ goto_point 2144.27 -2248.9321 20.6641   mode 4 -2 ms 
end                                                       
if                                                        
147@ == 9                                                 
then                                                      
05D3: AS_actor 67@ goto_point 2124.9932 -2266.8147 20.6673 mode 4 -2 ms 
end                                                       
if                                                        
147@ == 10                                                
then                                                      
05D3: AS_actor 67@ goto_point 2134.1306 -2275.8506 20.6719 mode 4 -2 ms 
end                                                       
if                                                        
147@ == 11                                                
then                                                      
05D3: AS_actor 67@ goto_point 2139.3755 -2270.9983 17.5625 mode 4 -2 ms 
end                                                       
if                                                        
147@ == 12                                                
then                                                      
05D3: AS_actor 67@ goto_point 2134.1743 -2265.7319 14.7861 mode 4 -2 ms 
end                                                       
if                                                        
147@ == 13                                                
then                                                      
05D3: AS_actor 67@ goto_point 2145.3733 -2261.4651 13.2984 mode 4 -2 ms 
end
:MISSN_06_360
//Guard 5 walks a loop path
if and
not Actor.Dead(68@)
02A0:   actor 68@ stopped 
jf @MISSN_06_370
148@ += 1
if 
148@ >= 8 
then
148@ = 0
end

if
148@ == 0
then
05D3: AS_actor 68@ goto_point 2178.282 -2251.1094 20.6719  mode 4 -2 ms 
end                                                       
if                                                        
148@ == 1                                                 
then                                                      
05D3: AS_actor 68@ goto_point 2143.4243 -2286.1931 20.6719 mode 4 -2 ms 
end                                                       
if                                                        
148@ == 2                                                 
then                                                      
05D3: AS_actor 68@ goto_point 2135.5798 -2277.9062 20.6719 mode 4 -2 ms 
end                                                       
if                                                        
148@ == 3                                                 
then                                                      
05D3: AS_actor 68@ goto_point 2140.697 -2272.4546 17.5625  mode 4 -2 ms 
end                                                       
if                                                        
148@ == 4                                                 
then                                                      
05D3: AS_actor 68@ goto_point 2147.0872 -2277.5708 14.7802 mode 4 -2 ms 
end                                                       
if                                                        
148@ == 5                                                 
then                                                      
05D3: AS_actor 68@ goto_point 2140.697 -2272.4546 17.5625  mode 4 -2 ms 
end                                                       
if                                                        
148@ == 6                                                 
then                                                      
05D3: AS_actor 68@ goto_point 2135.5798 -2277.9062 20.6719 mode 4 -2 ms 
end                                                       
if                                                        
148@ == 7                                                 
then                                                      
05D3: AS_actor 68@ goto_point 2143.4243 -2286.1931 20.6719 mode 4 -2 ms 
end                           

:MISSN_06_370
if and
142@ == 0
00FE:   actor $PLAYER_ACTOR sphere 1 in_sphere 2132.3655 -2276.9238 20.6719 radius 1.0 1.0 1.0 
then
    142@ = 4   //Check Point to eves drop on the conversation.
    Actor.Angle($PLAYER_ACTOR) = 233.0
    04EB: AS_actor $PLAYER_ACTOR crouch 1 
    wait 1000
end

//Guard spots Frank ALARM is Raised
146@ += 1
if 
146@ >= 5
then
    146@ = 0
end
//*See code comment above; the distance is cut back for inside.
if 
    not Actor.Dead(64@(146@,5i))
then
    04C4: store_coords_to 151@ 152@ 153@ from_actor 64@(146@,5i) with_offset 0.0 2.5 0.0 
    if 
      031D:   actor 64@(146@,5i) hit_by_weapon 23
    then
      05E2: AS_actor 64@(146@,5i) kill_actor $PLAYER_ACTOR   
    end
    if and
    143@ >= 0
    00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 151@ 152@ 153@ radius 3.0 3.0 3.0 
    then
        jump @MISSN_06_500
    end
end

if
142@ == 4 
jf @MISSN_06_310

Actor.DestroyWithFade(64@)
Actor.DestroyWithFade(65@)
Actor.DestroyWithFade(66@)
Actor.DestroyWithFade(67@)
Actor.DestroyWithFade(68@)
//cut scene
02A3: enable_widescreen 1 
Player.CanMove($PLAYER_CHAR) = False
00BC: show_text_highpriority GXT 'GEX04' time 7000 flag 1  
03CF: load_wav 45000 as 1
gosub @MISSN_06_PLAY
00BC: show_text_highpriority GXT 'GEX05' time 4000 flag 1  
03CF: load_wav 45001 as 1
gosub @MISSN_06_PLAY
00BC: show_text_highpriority GXT 'GEX06' time 9000 flag 1  
03CF: load_wav 45002 as 1
gosub @MISSN_06_PLAY
00BC: show_text_highpriority GXT 'GEX07' time 2000 flag 1  
03CF: load_wav 45003 as 1
gosub @MISSN_06_PLAY
00BC: show_text_highpriority GXT 'GEX08' time 7000 flag 1  
03CF: load_wav 45004 as 1
gosub @MISSN_06_PLAY
00BC: show_text_highpriority GXT 'GEX09' time 5000 flag 1  
03CF: load_wav 45255 as 1
gosub @MISSN_06_PLAY
00BC: show_text_highpriority GXT 'GEX10' time 3000 flag 1  
03CF: load_wav 45005 as 1
gosub @MISSN_06_PLAY
00BC: show_text_highpriority GXT 'GEX11' time 5000 flag 1  
03CF: load_wav 45245 as 1
gosub @MISSN_06_PLAY
00BC: show_text_highpriority GXT 'GEX12' time 5000 flag 1  
wait 4000
Fade 0 0
:MISSN_06_FADEOUT
wait 0
if 
not fading
jf @MISSN_06_FADEOUT

0395: clear_area 0 at 1036.86 -1336.49 20.0 radius 20.0 
02E4: load_cutscene_data 'CRASH3A' 
054C: use_GXT_table 'CRASH3'
04FA: reset_interior 0 colors 
:MISSN_06_420
wait 0 
if 
06B9:   cutscene_data_loaded 
jf @MISSN_06_420 

02E7: start_cutscene 

:MISSN_06_430
wait 0
if 
02E9:   cutscene_reached_end 
jf @MISSN_06_430
Model.Load(#COPCARLA)
fade 0 0 

Actor.PutAt($PLAYER_ACTOR, 1570.2164, -1703.0057, 5.8906)
04EB: AS_actor $PLAYER_ACTOR crouch 0
//Create CRASH unit 
:MISSN_06_435
wait 0
if
Model.Available(#COPCARLA)
jf @MISSN_06_435

0674: set_car_model #COPCARLA numberplate "_CRASH_"
15@ = Car.Create(#COPCARLA, 1590.2164, -1703.0057, 5.8906) 
Car.Angle(15@) = 175.0                     
Car.DoorStatus(15@, 0)                   
053F: set_car 15@ tires_vulnerability 0  
036A: put_actor $PLAYER_ACTOR in_car 15@ 

fade 1 2000 
:MISSN_06_440
wait 0
if 
fading 
jf @MISSN_06_440 
02EA: end_cutscene 
02A3: enable_widescreen 0 
Player.CanMove($PLAYER_CHAR) = True

//Mission Complete
0394: play_music 1 
Player.ClearWantedLevel($PLAYER_CHAR)
01E3: show_text_1number_styled GXT 'M_PASSR' number 7 time 5000 style 1  // MISSION PASSED!~n~~w~RESPECT +
0998: add_respect 1
wait 5000 
$CRASH_MARKER = Marker.CreateIconAndSphere(16, 1541.1016, -1675.4501, 13.5519) 
return

{At this point you have failed the mission because you were spotted and the script is waiting for 
one of two possible ways to inform you. 1 your actor dies or 2 you are forced to leave the warehouse area.}
:MISSN_06_500
054C: use_GXT_table 'CRASH3'
03CF: load_wav 11008 as 1 
0949: link_wav 1 to_actor 64@(146@,5i) 
:MISSN_06_510
wait 0
if 
03D0:   wav 1 loaded 
jf @MISSN_06_510
03D1: play_wav 1 
00BC: show_text_highpriority GXT 'CRA3_EA' time 2500 flag 1  // ~z~Hey, who the fuck are you?
wait 3000
054C: use_GXT_table 'JABM06'
00BC: show_text_highpriority GXT 'GEX13' time 4000 flag 1  
wait 4000
00BC: show_text_highpriority GXT 'GEX14' time 4000 flag 1  
wait 2000

143@ = -1
144@ = -1
145@ = -1
147@ = -1
148@ = -1
03C7: set_sensitivity_to_crime 1.0 
010E: set_player $PLAYER_CHAR minimum_wanted_level_to 2 

//ALARM!!  Call 911
//Hunting Season Opens Today "KILL THE WABBIT!"
if
not Actor.Dead(64@)
jf @MISSN_06_530
05E2: AS_actor 64@ kill_actor $PLAYER_ACTOR 
:MISSN_06_530
if
not Actor.Dead(65@)
jf @MISSN_06_531
05E2: AS_actor 65@ kill_actor $PLAYER_ACTOR 
:MISSN_06_531
if
not Actor.Dead(66@)
jf @MISSN_06_532
05E2: AS_actor 66@ kill_actor $PLAYER_ACTOR 
:MISSN_06_532
if
not Actor.Dead(67@)
jf @MISSN_06_533
05E2: AS_actor 67@ kill_actor $PLAYER_ACTOR 
:MISSN_06_533
if
not Actor.Dead(68@)
jf @MISSN_06_534
05E2: AS_actor 68@ kill_actor $PLAYER_ACTOR 

:MISSN_06_534
wait 0
if and 
not Actor.Dead($PLAYER_ACTOR)                    
00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 2190.7534 -2269.3474 13.5974 radius 80.0 80.0 80.0 
jf @MISSN_06_800

jump @MISSN_06_534

:MISSN_06_800
if
8366:   not object 51@ damaged 
jf @MISSN_06_810

00BC: show_text_highpriority GXT 'GEX16' time 5000 flag 1  
wait 4000
jump @MISSN_06_820

:MISSN_06_810
00BC: show_text_highpriority GXT 'GEX15' time 5000 flag 1  
wait 4000

:MISSN_06_820
00BA: show_text_styled GXT 'M_FAIL' time 5000 style 1  // ~r~MISSION FAILED!
$CRASH_MARKER = Marker.CreateIconAndSphere(16, 2247.639, -2202.144, 12.59) 
return

//Play Audio
:MISSN_06_PLAY
wait 0
if  
03D0:   wav 1 loaded 
jf @MISSN_06_PLAY

03D1: play_wav 1

:MISSN_06_UNLOAD 
wait 0

if 
03D2:   wav 1 ended 
jf @MISSN_06_UNLOAD 
040D: unload_wav 1
return




